# Contributor: Dermot Bradley <dermot_bradley@yahoo.com>
# Maintainer: Laurent Bercot <ska-devel@skarnet.org>
pkgname=s6-overlay
pkgver=3.1.6.2
pkgrel=1
pkgdesc="s6 overlay for containers"
url=https://github.com/just-containers/s6-overlay
arch="noarch"
license="ISC"
depends="execline s6 s6-rc s6-linux-init s6-portable-utils s6-linux-utils s6-dns s6-networking s6-overlay-helpers"
subpackages="$pkgname-doc $pkgname-syslogd"
options="!check"
source="$pkgname-$pkgver.tar.gz::https://github.com/just-containers/s6-overlay/archive/refs/tags/v$pkgver.tar.gz"

build() {
	make rootfs-overlay-noarch symlinks-overlay-noarch syslogd-overlay-noarch \
		"VERSION=$pkgver" \
		SHEBANGDIR=/bin
}

package() {
	mkdir -p "$pkgdir"
	cp -a "$builddir/output/rootfs-overlay-noarch"/* \
		"$builddir/output/symlinks-overlay-noarch"/* \
		"$pkgdir/"
}

doc() {
	default_doc
	mkdir -p "$subpkgdir/usr/share/doc/$pkgname"
	cp "$builddir/AUTHORS.md" \
		"$builddir/CHANGELOG.md" \
		"$builddir/CONTRIBUTING" \
		"$builddir/COPYING" \
		"$builddir/DCO" \
		"$builddir/MOVING-TO-V3.md" \
		"$builddir/README.md" \
		"$subpkgdir/usr/share/doc/$pkgname/"
}

syslogd() {
	mkdir -p "$subpkgdir"
	cp -a "$builddir/output/syslogd-overlay-noarch"/* "$subpkgdir/"
}

sha512sums="
48fbe2a524ac77fe239a0183bb31e70e9e53df8e2d80605b71ea722f2b8391f332a3e0062a70fe24a241889ac00eddd61c8fd92f6c4d8f2ba0681aaff1f38f34  s6-overlay-3.1.6.2.tar.gz
"
